/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.bus.api;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.persistence.ResponseResult;
import com.thinkgem.jeesite.common.persistence.RestfulPage;
import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.modules.bus.entity.Audit;
import com.thinkgem.jeesite.modules.bus.service.AuditService;

/**
 * restful demo
 * 所有的api返回值均为ResponseResult，在ResponseResult内赋予相关的对象
 * @author waile23
 * @version 2017-11-12
 */
@RestController
@RequestMapping(value = "${wechatPath}/rest/notice")
public class RestNoticeController extends BaseController{
    
    @Autowired
	private AuditService auditService;

	/**
	 * 
	* @Title: getNotice 
	* @author: ZYJ
	* @date: 2019年6月11日 下午1:49:34 
	* @Description: 获取通知
	* @param: id
	* @return: ResponseResult
	* @throws
	 */
	@RequestMapping(value = "getNotice", method = RequestMethod.GET)
	public ResponseResult getNotice(HttpServletRequest request, HttpServletResponse response) throws Exception {
		try {
			Page<Audit> restfulPage = new RestfulPage<Audit>(request, response);
			Page<Audit> page = auditService.findListByEntId(restfulPage);
			return ResponseResult.success(page);
		} catch(Exception e) {
			return ResponseResult.failure(e.getMessage());
		}
	}
	
	/**
	 * 
	* @Title: updateNoticeStatus 
	* @author: ZYJ
	* @date: 2019年6月12日 上午9:05:20 
	* @Description: 修改通知读取标识
	* @param: @return
	* @return: ResponseResult
	* @throws
	 */
	@RequestMapping(value = "updateNoticeStatus", method = RequestMethod.POST)
	public ResponseResult updateNoticeStatus() throws Exception {
		try {
			auditService.updateNoticeStatus();
		} catch(Exception e) {
			return ResponseResult.failure(e.getMessage());
		}
		return ResponseResult.success();
	}
}